        //enter键快捷登录
		document.onkeydown = function (event) {
		    var e = event || window.event || arguments.callee.caller.arguments[0];
		    if (e && e.keyCode == 13) {
		        myselect();
		    }
		};
		/*地图定位*/
		mapObj = new AMap.Map('mapID');
		mapObj.plugin('AMap.Geolocation', function() {
			geolocation = new AMap.Geolocation({
				enableHighAccuracy: true, //是否使用高精度定位，默认:true
				timeout: 10000 //超过10秒后停止定位，默认：无穷大
			});
			geolocation.getCurrentPosition(function(status, result) {//定位
				if(status == "complete") {
					//alert(result.addressComponent.province)
					$("#currCityName span").html(result.addressComponent.province);
				}else{
					$("#currCityName span").html("定位失败");
				}
			});
			//AMap.event.addListener(geolocation, 'complete', onComplete); //返回定位完成信息
			//AMap.event.addListener(geolocation, 'error', onError); //返回定位出错信息
		});
		$(function() {
			load("北京市");
			h = window.innerHeight;
			//alert(h);
			StyleMatch(h);
		});
		$("body").on("touchmove",function(event){
			event.preventDefault;
		}, false);
		/*手机样式适配函数*/
		function StyleMatch(_h){
			if(_h < 510) {//5S手机高度：h=504
				$("#swipercontainer").addClass("item_5_1");
			} else if(_h < 530) {//7p手机高度：h=529
				$("#swipercontainer").addClass("item_6_1");
			} else if(_h < 540) {
				$("#swipercontainer").addClass("item_7_1");
			} else if(_h < 580) {
				$("#swipercontainer").addClass("item_8_1");
			} else if(_h < 670) {
				$("#swipercontainer").addClass("item_8_1");
			} else {
				$("#swipercontainer").addClass("item_8_1");
			}
		}
		/*加载函数*/
		function load(adcode) {
			var loadIndex = layer.open({
				type: 2,
				content: '加载中'
			});
			var postData = {
				key: "dfb9a576fbcb2c9a13a65ab736e47004",
				city: adcode,
				extensions: "all"
			};
			$.ajax({
				//type: "get",
				url: "https://restapi.amap.com/v3/weather/weatherInfo",
				data: postData,
//				dataType: "jsonp",
				success: function(data) {
					if(data.status == 1) {
						layer.close(loadIndex);
						if(data.count == 0) {
							layer.open({
								content: '未查询到该城市信息，请重新输入！',
								btn: '确定'
							});
						} else {
							var obj = data.forecasts[0];
							/*加载上部分的数据*/
							$("#one").html(obj.city);
							var classname = "";
							classname = "iconfont " + weatherIcon(obj.casts[0].dayweather);
							$("#topimg").attr("class", classname);
							$("#temp").html(obj.casts[0].nighttemp + "℃/" + obj.casts[0].daytemp + "℃");
							$("#dayweather").html(obj.casts[0].dayweather);
							$("#wind").html(obj.casts[0].daywind + "风" + obj.casts[0].daypower + "级");
							$("#date").html("" + obj.casts[0].date + "&nbsp;&nbsp;" + formatWeek(obj.casts[0].week));
							/*下面的轮播图数据*/
							var casts = data.forecasts[0].casts;
							var resultStr = "";
							$.each(casts, function(i, item) {
								resultStr += "<div class=\"swiper-slide\">";
								resultStr += "	<section>";
								resultStr += "		<p>" + formatWeek(item.week) + "</p>";
								resultStr += "		<i class=\"iconfont " + weatherIcon(item.dayweather) + "\"></i>";
								resultStr += "		<p>" + item.nighttemp + "℃/" + item.daytemp + "℃" + "</p>";
								resultStr += "		<p>" + item.dayweather + "</p>";
								resultStr += "	</section>";
								resultStr += "</div>";
							});
							$("#swiperHtml").html(resultStr);
							var swiper = new Swiper('.swiper-container', {
								pagination: '.swiper-pagination',
								slidesPerView: 2,
								spaceBetween: 0
							});
							$(".mylayer").hide();
							$('.downdiv').removeClass("updiv");
						}
					} else {
						layer.close(loadIndex);
						layer.open({
							content: '未查询到该城市信息，请重新输入！',
							btn: '确定'
						});
					}
				}
			});
		}

		/*点击遮罩层函数*/
		function mylayer() {
			$(".mylayer").hide();
			$('.downdiv').removeClass("updiv");
		}
		/*右上角图标点击函数*/
		function myshow() {
			$(".mylayer").show();
			$('.downdiv').addClass("updiv");
			$(".downdiv").show();
		}
		/*点击查询函数*/
		function myselect() {
			var cityName = $("#cityName").val();
			if(cityName == "") {
				layer.open({
					content: '请输入城市名称！',
					btn: '确定'
				});
				return;
			} else {
				load(cityName);
			}
		}
		/*预报图标函数*/
		function weatherIcon(str) {
			var res = "icon-xiaoyu1";
			if(/^晴$/.test(str)) {
				res = "icon-qing";
			} else if(/^小雨$/.test(str)) {
				res = "icon-xiaoyu1";
			} else if(/^中雨$/.test(str)) {
				res = "icon-zhongyu	";
			} else if(/^大雨$/.test(str)) {
				res = "icon-dayu";
			} else if(/^大暴雨$/.test(str)) {
				res = "icon-dabaoyu";
			} else if(/^阵雨$/.test(str)) {
				res = "icon-zhenyu";
			} else if(/^雷阵雨$/.test(str)) {
				res = "icon-leizhenyu";
			} else if(/^雷电$/.test(str)) {
				res = "icon-leidian";
			} else if(/^冻雨$/.test(str)) {
				res = "icon-dongyu";
			} else if(/^冰雹$/.test(str)) {
				res = "icon-tianqitubiao_bingbao";
			} else if(/^大风$/.test(str)) {
				res = "icon-tianqitubiao_dafeng";
			} else if(/^扬沙$/.test(str)) {
				res = "icon-tianqitubiao_yangsha";
			} else if(/^浮尘$/.test(str)) {
				res = "icon-fuchen";
			} else if(/^沙尘暴$/.test(str)) {
				res = "icon-shachenbao";
			} else if(/^雾霾$/.test(str)) {
				res = "icon-wumai";
			} else if(/^雾$/.test(str)) {
				res = "icon-wu";
			} else if(/雪/.test(str)) {
				res = "icon-baoxue";
			} else if(/^多云$/.test(str)) {
				res = "icon-duoyun";
			} else if(/^阴$/.test(str)) {
				res = "icon-yin";
			}
			return res;
		}
		/*判断星期几*/
		function formatWeek(k) {
			var res = "";
			if(k == 1) {
				res = "星期一";
			} else if(k == 2) {
				res = "星期二";
			} else if(k == 3) {
				res = "星期三";
			} else if(k == 4) {
				res = "星期四";
			} else if(k == 5) {
				res = "星期五";
			} else if(k == 6) {
				res = "星期六";
			} else if(k == 7) {
				res = "星期日";
			}
			return res;
		}
		
